//
//	  Line.java
//
//	  Copyright (c) 2011 <John Lawniczak>
//	  jlawniczak340license@gmail.com
//
//    This file is part of CS102_Assignment2.
//
//    CS102_Assignment2 is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, version 3 of the License.
//
//    CS102_Assignment2 is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with CS102_Assignment2.  If not, see <http://www.gnu.org/licenses/>.
//

/**************************************************
Class Name:Line
Author's Name:John Lawniczak
Date:05-05-2010
Description of the class: a line for  file that holds
 	a single line of a file, type of the file's linked list
***************************************/
public class Line {
	private String text; 
	private int numWords, numChars;
	public Line(String txt){
		text = txt;
		setNumWords(text.split("\\s").length);
		setNumChars(text.length());
	}
	private void setNumWords(int numWords) {
		this.numWords = numWords;
	}
	public int getNumWords() {
		return numWords;
	}
	private void setNumChars(int numChars) {
		this.numChars = numChars;
	}
	public int getNumChars() {
		return numChars;
	}
	
	public void findReplaceAll(String find, String replace){
		System.out.println("finding: " + find + ", replacing: " + replace);
		text = text.replaceAll(find, replace);
	}
	
	public String getText(){
		return text;
	}

}
